<template>
  <view class="token-page">
    <InputField v-model="token" label="Token" placeholder="请输入token" />
    <InputField v-model="expireDate" label="过期日期" placeholder="请输入过期日期，如：2025/3/1" />
    <CustomButton text="确定" @click="handleSubmit" backgroundColor="#409eff" />
  </view>
</template>

<script setup>
import { ref } from 'vue'
import InputField from '@/components/InputField.vue'
import CustomButton from '@/components/CustomButton.vue'

const token = ref(uni.getStorageSync('token') || '')
const expireDate = ref(uni.getStorageSync('tokenExpireDate') || '')

const handleSubmit = () => {
  uni.setStorageSync('token', token.value)
  uni.setStorageSync('tokenExpireDate', expireDate.value)
  uni.showToast({
    title: '保存成功',
    icon: 'success'
  })
  uni.navigateBack()
}
</script>

<style lang="scss" scoped>
.token-page {
  padding: 32rpx;
  display: flex;
  flex-direction: column;
  gap: 40rpx;
}
</style>